var request_path={
	//server是后端地址，剩下的为接口地址
	server:'http://localhost:8088/okok/',
    login:'api/profile/login.action',
    register:'api/profile/register.action',
};


//Ajax提交
function AjaxPost(Url,Data,LodingFun,ReturnFun) {
    $.ajax({
        type: "post",
        url: request_path.server + request_path[Url],
        data: Data,
        dataType: 'json',
        contentType : 'application/x-www-form-urlencoded',
        async: 'false',
        beforeSend: LodingFun,
        error: function () { AjaxErro({ "Status": "Erro", "Erro": 500}); },
        success: ReturnFun
    });
}
//示例
//AjaxPost("ajax调用路径", ajax传参,
//                function () {
//                     //ajax加载中
//                },
//                function (data) {
//                    //ajax返回 
//                    //AjaxErro(data);
//                })


//弹出
function ErroAlert(e) {
    var index = layer.alert(e, { icon: 5, time: 2000, offset: 't', closeBtn: 0, title: '错误信息', btn: [], anim: 2, shade: 0 });
    layer.style(index, {
        color: '#777'
    }); 
}

//Ajax 错误返回处理
function AjaxErro(e) {
    if (e.Status == "Erro") {
        switch (e.Erro) {
            case "500":
                layer.msg("错误 : 错误代码 '500'");
                break;
            case "100001":
                layer.msg("错误 : 错误代码 '100001'");
                break;
            default:
                layer.msg("e.Erro");
        }
    } else {
        layer.msg(e);
    }
}